import {
    DetailAxios
} from "@/api/index"

const actions = {
    async getGoodDetail(miniStore, skuId) {
        const re = await DetailAxios(skuId);
        if (re.code === 200) {
            miniStore.commit("SET_GOODDETAIL_STATE", re.data)
        }
    }
};
const mutations = {
    SET_GOODDETAIL_STATE(state, value) {
        state.GoodDetail = value
    }
};
const state = {
    GoodDetail: {}
};
const getters = {
    categoryView(state) {
        return state.GoodDetail.categoryView || {}
    },
    price(state) {
        return state.GoodDetail.price || ""
    },
    skuInfo(state) {
        return state.GoodDetail.skuInfo || {}
    },
    spuSaleAttrList(state) {
        return state.GoodDetail.spuSaleAttrList ||[]
    }
}



export default {
    actions,
    mutations,
    state,
    getters
}